using Ocelot.Configuration.File;

namespace Beauty.Net.Ocelot.Core;

/// <summary>
/// Ocelot配置管理器接口
/// </summary>
public interface IOcelotConfigurationManager
{
    /// <summary>
    /// 获取当前配置
    /// </summary>
    Task<FileConfiguration> GetConfigurationAsync(CancellationToken cancellationToken = default);
    
    /// <summary>
    /// 更新配置
    /// </summary>
    Task<bool> UpdateConfigurationAsync(FileConfiguration configuration, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// 添加路由
    /// </summary>
    Task<bool> AddRouteAsync(FileRoute route, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// 更新路由
    /// </summary>
    Task<bool> UpdateRouteAsync(string routeKey, FileRoute route, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// 删除路由
    /// </summary>
    Task<bool> DeleteRouteAsync(string routeKey, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// 重新加载配置
    /// </summary>
    Task<bool> ReloadConfigurationAsync(CancellationToken cancellationToken = default);
    
    /// <summary>
    /// 导出配置到文件
    /// </summary>
    Task<bool> ExportConfigurationAsync(string filePath, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// 从配置选项创建Ocelot配置
    /// </summary>
    FileConfiguration CreateConfigurationFromOptions(List<ApiRouteOptions> routes);
}